package com.iknow.util;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class SqlUtil
{
  public static boolean isExist(SQLiteDatabase paramSQLiteDatabase, String paramString)
  {
    int i = 0;
    String[] arrayOfString = new String[1];
    arrayOfString[0] = "COUNT(1) AS c";
    Cursor localCursor = paramSQLiteDatabase.query(paramString, arrayOfString, "rowid = 1", null, null, null, null);
    if (localCursor != null)
    {
      if ((localCursor.moveToNext()) && (localCursor.getInt(localCursor.getColumnIndex("c")) > 0))
        i = 1;
      localCursor.close();
    }
    return i;
  }

  public static boolean isExist(SQLiteDatabase paramSQLiteDatabase, String paramString1, String paramString2)
  {
    int i = 0;
    String[] arrayOfString = new String[1];
    arrayOfString[0] = "COUNT(1) AS c";
    Cursor localCursor = paramSQLiteDatabase.query(paramString1, arrayOfString, paramString2, null, null, null, null);
    if (localCursor != null)
    {
      if ((localCursor.moveToNext()) && (localCursor.getInt(localCursor.getColumnIndex("c")) > 0))
        i = 1;
      localCursor.close();
    }
    return i;
  }
}